﻿<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class c_search extends CI_Controller {

	public function __construct(){
		parent::__construct();
		$this ->cache = 1;
	}
	
	public function index($lang)
	{
		echo $data['wordSearch'] = trim($this->input->post('w', TRUE));
		$data['lang'] = $lang;
		$this->load->Model("m_search");
		$data['get100'] = $this->m_search->get100($lang);
		$this->load->view("trangchu",$data);
	}
	
	public function search($wordSearch,$lang){
		$this->output->cache($this ->cache);//caching trong 5 phut
		$this->load->Model("m_search");
		$data['wordSearch']= $wordSearch;
		$data["Words"]=$this->m_search->search($wordSearch,$lang);
		$data["WordsLike"]=$this->m_search->like($wordSearch,$lang);
		$data['lang'] = $lang;
		$this->load->view("v_search",$data);
	}
}